from Common.conftest import GetToken
from Common.request_method import RestClient
import yaml
import os
import pytest
from Common.logger import logger
import requests


class StorageAllocation(GetToken, RestClient):
    task_id_1_str = None  # 类属性，在所有实例之间共享

    def __init__(self):
        file_path1 = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'ym.yml'))
        with open(file_path1, "r") as file:
            data = yaml.safe_load(file)
            base_url = data.get("base_url")
            token = data.get("token")
            self.base_url = base_url
            self.token = token
        file_path2 = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'policy_task_id.yml'))
        with open(file_path2, 'r') as file:
            data1 = yaml.safe_load(file)
            task_id_1 = data1.get("policy_task_id1")
            task_id_2 = data1.get("policy_task_id2")
            self.policy_task_id = task_id_1
            self.policy_task_id2 = task_id_2
        file_path3 = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'root_task_id.yml'))
        with open(file_path3, 'r') as file:
            data1 = yaml.safe_load(file)
            root_task_id_1 = data1.get("root_task_id1")
            root_task_id_2 = data1.get("root_task_id2")
            self.root_task_id = root_task_id_1
            self.root_task_id2 = root_task_id_2
    def ad_broad_targeting_policy(self, get_api_profiler):
        """
        SP广泛投放策略
        :param get_token:
        :param get_api_profiler:
        :return:
        """
        url = self.base_url + "/v1/ad_strategy/broad_targeting_policy"
        headers = {
            "Authorization": self.token,
            "Carving-Advertising-Api-Profile": get_api_profiler
        }
        json = {
            "ad_type": "sp",
            "rule_model": "normal",
            "module": "sp_broad_targeting_keyword_normal",
            "ad_group_configs": [
                {
                    "ad_campaign_type": "sp_manual_campaign",
                    "ad_group_id": 26500014051094,
                    "ad_group_name": "广泛组",
                    "ad_group_type": "sp_broad_keyword_group",
                    "campaign_id": 122356139507810,
                    "campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "id": 805,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 805
                }
            ],
            "campaign_configs": [
                {
                    "campaign_id": 122356139507810,
                    "campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "hight_up_limit": 3.5,
                    "low_down_limit": 0.2,
                    "price": 39.99,
                    "strategy_config": 0,
                    "target_cr": 20
                }
            ]
        }
        response = self.request(method="POST", url=url, headers=headers, json=json)
        return response

    def ad_broad_search_policy1(self, get_api_profiler):
        """
          SP广泛搜索词-模型1
          :param get_token:
          :param get_api_profiler:
          :return:
          """
        url = self.base_url + "/v1/ad_strategy/broad_search_policy"
        headers = {
            "Authorization": self.token,
            "Carving-Advertising-Api-Profile": get_api_profiler
        }
        json = {
            "ad_type": "sp",
            "module": "sp_broad_search_keyword_model_1",
            "campaign_configs": [
                {
                    "campaign_id": 122356139507810,
                    "campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "hight_down_limit": 2,
                    "hight_up_limit": 3.5,
                    "low_down_limit": 0.2,
                    "price": 39.99,
                    "strategy_config": 0,
                    "target_cr": 20
                }
            ],
            "ad_group_configs": [
                {
                    "ad_campaign_type": "sp_manual_campaign",
                    "ad_group_id": 26500014051094,
                    "ad_group_name": "广泛组",
                    "ad_group_type": "sp_broad_keyword_group",
                    "campaign_id": 122356139507810,
                    "campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "id": 805,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 805
                }
            ],
            "rule_model": "1"
        }
        response = self.request(method="POST", url=url, headers=headers, json=json)
        return response

    def ad_broad_search_policy2(self, get_api_profiler):
        """
          SP广泛搜索词-模型2
          :param get_token:
          :param get_api_profiler:
          :return:
          """
        url = self.base_url + "/v1/ad_strategy/broad_search_policy"
        headers = {
            "Authorization": self.token,
            "Carving-Advertising-Api-Profile": get_api_profiler
        }
        json = {
            "ad_type": "sp",
            "module": "sp_broad_search_keyword_model_2",
            "campaign_configs": [
                {
                    "campaign_id": 122356139507810,
                    "campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "filter_time_type": 0,
                    "hight_down_limit": 2,
                    "hight_up_limit": 3.5,
                    "low_down_limit": 0.2,
                    "price": 39.99,
                    "strategy_config": 0,
                    "target_cr": 20
                }
            ],
            "ad_group_configs": [
                {
                    "ad_campaign_type": "sp_manual_campaign",
                    "ad_group_id": 26500014051094,
                    "ad_group_name": "广泛组",
                    "ad_group_type": "sp_broad_keyword_group",
                    "campaign_id": 122356139507810,
                    "campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "id": 805,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 805
                }
            ],
            "rule_model": "2"
        }
        response = self.request(method="POST", url=url, headers=headers, json=json)
        return response

    def ad_high_low_strategy(self, get_api_profiler):
        """
          SP高低转化投放
          :param get_token:
          :param get_api_profiler:
          :return:
          """
        url = self.base_url + "/v1/ad_strategy/high_low_strategy"
        headers = {
            "Authorization": self.token,
            "Carving-Advertising-Api-Profile": get_api_profiler
        }
        json = {
            "ad_type": "sp",
            "module": "sp_high_low_conversion_keyword_normal",
            "rule_model": "normal",
            "ad_group_configs": [
                {
                    "ad_campaign_type": "sp_manual_campaign",
                    "ad_group_id": 102199737206276,
                    "ad_group_name": "低转化1",
                    "ad_group_type": "sp_high_low_conversion_keyword_group",
                    "campaign_id": 122356139507810,
                    "campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "id": 833,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 833
                },
                {
                    "ad_campaign_type": "sp_manual_campaign",
                    "ad_group_id": 156106611284284,
                    "ad_group_name": "高转化",
                    "ad_group_type": "sp_high_low_conversion_keyword_group",
                    "campaign_id": 122356139507810,
                    "campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "id": 804,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 804
                },
                {
                    "ad_campaign_type": "sp_manual_campaign",
                    "ad_group_id": 170457293681867,
                    "ad_group_name": "低转化2",
                    "ad_group_type": "sp_high_low_conversion_keyword_group",
                    "campaign_id": 122356139507810,
                    "campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "id": 834,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 834
                },
                {
                    "ad_campaign_type": "sp_manual_campaign",
                    "ad_group_id": 252924249068096,
                    "ad_group_name": "低转化3",
                    "ad_group_type": "sp_high_low_conversion_keyword_group",
                    "campaign_id": 122356139507810,
                    "campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "id": 836,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 836
                },
                {
                    "ad_campaign_type": "sp_manual_campaign",
                    "ad_group_id": 322359928200188,
                    "ad_group_name": "低转化6",
                    "ad_group_type": "sp_high_low_conversion_keyword_group",
                    "campaign_id": 122356139507810,
                    "campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "id": 855,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 855
                },
                {
                    "ad_campaign_type": "sp_manual_campaign",
                    "ad_group_id": 364061210685418,
                    "ad_group_name": "低转化7",
                    "ad_group_type": "sp_high_low_conversion_keyword_group",
                    "campaign_id": 122356139507810,
                    "campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "id": 131062,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 131062
                },
                {
                    "ad_campaign_type": "sp_manual_campaign",
                    "ad_group_id": 385033929838469,
                    "ad_group_name": "低转化4",
                    "ad_group_type": "sp_high_low_conversion_keyword_group",
                    "campaign_id": 122356139507810,
                    "campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "id": 837,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 837
                },
                {
                    "ad_campaign_type": "sp_manual_campaign",
                    "ad_group_id": 406608947462936,
                    "ad_group_name": "低转化5",
                    "ad_group_type": "sp_high_low_conversion_keyword_group",
                    "campaign_id": 122356139507810,
                    "campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "id": 853,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 853
                },
                {
                    "ad_campaign_type": "sp_manual_campaign",
                    "ad_group_id": 486973744106007,
                    "ad_group_name": "高转化2",
                    "ad_group_type": "sp_high_low_conversion_keyword_group",
                    "campaign_id": 122356139507810,
                    "campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "id": 854,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 854
                },
                {
                    "ad_campaign_type": "sp_manual_campaign",
                    "ad_group_id": 537268057226569,
                    "ad_group_name": "高转化3",
                    "ad_group_type": "sp_high_low_conversion_keyword_group",
                    "campaign_id": 122356139507810,
                    "campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "id": 56916,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 56916
                }
            ],
            "campaign_configs": [
                {
                    "campaign_id": 122356139507810,
                    "campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "hight_down_limit": 2,
                    "hight_up_limit": 3.5,
                    "low_down_limit": 0.2,
                    "low_up_limit": 1.2,
                    "price": 39.99,
                    "strategy_config": 0,
                    "target_cr": 20
                }
            ]
        }
        response = self.request(method="POST", url=url, headers=headers, json=json)
        return response

    def ad_asin_targeting_policy(self, get_api_profiler):
        """
          SP-ASIN投放
          :param get_token:
          :param get_api_profiler:
          :return:
          """
        url = self.base_url + "/v1/ad_strategy/asin_targeting_policy"
        headers = {
            "Authorization": self.token,
            "Carving-Advertising-Api-Profile": get_api_profiler
        }
        json = {
            "ad_type": "sp",
            "rule_model": "normal",
            "module": "sp_asin_normal",
            "ad_group_configs": [
                {
                    "ad_campaign_type": "sp_asin_a_campaign",
                    "ad_group_id": 142236948975246,
                    "ad_group_name": "高转化",
                    "ad_group_type": "sp_asin_a_group",
                    "campaign_id": 59678734728722,
                    "campaign_name": "US-17*33in 电暖垫-ASIN组-B0B3MBQC57",
                    "id": 806,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 806
                },
                {
                    "ad_campaign_type": "sp_asin_a_campaign",
                    "ad_group_id": 255560078239991,
                    "ad_group_name": "低转化",
                    "ad_group_type": "sp_asin_a_group",
                    "campaign_id": 59678734728722,
                    "campaign_name": "US-17*33in 电暖垫-ASIN组-B0B3MBQC57",
                    "id": 807,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 807
                },
                {
                    "ad_campaign_type": "sp_asin_a_campaign",
                    "ad_group_id": 472307831941850,
                    "ad_group_name": "评分",
                    "ad_group_type": "sp_asin_a_group",
                    "campaign_id": 59678734728722,
                    "campaign_name": "US-17*33in 电暖垫-ASIN组-B0B3MBQC57",
                    "id": 841,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 841
                },
                {
                    "ad_campaign_type": "sp_asin_a_campaign",
                    "ad_group_id": 544384308851716,
                    "ad_group_name": "价格",
                    "ad_group_type": "sp_asin_a_group",
                    "campaign_id": 59678734728722,
                    "campaign_name": "US-17*33in 电暖垫-ASIN组-B0B3MBQC57",
                    "id": 839,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 839
                }
            ],
            "campaign_configs": [
                {
                    "asin_up_limit": 3,
                    "campaign_id": 59678734728722,
                    "campaign_name": "US-17*33in 电暖垫-ASIN组-B0B3MBQC57",
                    "low_down_limit": 0.6,
                    "price": 39.99,
                    "strategy_config": 0,
                    "target_acos": 33,
                    "target_cr": 20
                }
            ]
        }
        response = self.request(method="POST", url=url, headers=headers, json=json)
        return response

    def ad_large_phrase_policy(self, get_api_profiler):
        """
          SP-大词投放
          :param get_token:
          :param get_api_profiler:
          :return:
          """
        url = self.base_url + "/v1/ad_strategy/large_phrase_policy"
        headers = {
            "Authorization": self.token,
            "Carving-Advertising-Api-Profile": get_api_profiler
        }
        json = {
            "ad_type": "sp",
            "rule_model": "normal",
            "strategy_mode": 1,
            "module": "sp_large_phrase_keyword_normal",
            "ad_group_configs": [
                {
                    "ad_campaign_type": "sp_manual_campaign",
                    "ad_group_id": 176040193029833,
                    "ad_group_name": "大词组",
                    "ad_group_type": "sp_large_phrase_keyword_group",
                    "campaign_id": 122356139507810,
                    "campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "id": 810,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 810
                }
            ],
            "campaign_configs": [
                {
                    "campaign_id": 122356139507810,
                    "campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "core_keyword": "heating pads",
                    "hight_down_limit": 2,
                    "hight_up_limit": 3.5,
                    "low_down_limit": 0.2,
                    "price": 39.99,
                    "strategy_config": 0,
                    "target_cr": 20
                }
            ]
        }
        response = self.request(method="POST", url=url, headers=headers, json=json)
        return response

    def ad_auto_search_policy(self, get_api_profiler):
        """
          SP-自动搜索词-自动1-紧密
          :param get_token:
          :param get_api_profiler:
          :return:
          """
        url = self.base_url + "/v1/ad_strategy/auto_search_policy"
        headers = {
            "Authorization": self.token,
            "Carving-Advertising-Api-Profile": get_api_profiler
        }
        json = {

            "ad_type": "sp",
            "rule_model": "A",
            "module": "sp_auto_search_a_normal",
            "campaign_configs": [
                {
                    "asin_down_limit": 2,
                    "asin_up_limit": 3.5,
                    "campaign_id": 386582096614556,
                    "campaign_name": "US-17*33in 电暖垫-自动1-B0B3MBQC57",
                    "hight_down_limit": 2,
                    "hight_up_limit": 3.5,
                    "price": 39.99,
                    "strategy_config": 0,
                    "target_acos": 28,
                    "target_cr": 20
                }
            ],
            "ad_group_configs": [
                {
                    "ad_campaign_type": "sp_auto_a_campaign",
                    "ad_group_id": 549607339142042,
                    "ad_group_name": "自动1-紧密",
                    "ad_group_type": "sp_auto_search_a_group",
                    "campaign_id": 386582096614556,
                    "campaign_name": "US-17*33in 电暖垫-自动1-B0B3MBQC57",
                    "id": 840,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 840,
                    "allowed_campaign_id": 122356139507810,
                    "asin_allowed_campaign_id": 59678734728722,
                    "allowed_campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "asin_allowed_campaign_name": "US-17*33in 电暖垫-ASIN组-B0B3MBQC57"
                }
            ]
        }
        response = self.request(method="POST", url=url, headers=headers, json=json)
        return response
    def ad_auto_search_policy_submi(self, get_api_profiler):
        """
          SP-自动搜索词-自动1-紧密-相关性筛选 2步
          :param get_token:
          :param get_api_profiler:
          :return:
          """
        url = self.base_url + "/v1/ad_strategy/auto_search_policy_submit"
        headers = {
            "Authorization": self.token,
            "Carving-Advertising-Api-Profile": get_api_profiler
        }
        json = {
            "policy_task_id": self.policy_task_id,
            "asin_update_data": [
            ],
            "keyword_update_data": [
            ]
        }
        response = self.request(method="POST", url=url, headers=headers, json=json)
        return response
    def ad_auto_search_root_submit(self, get_api_profiler):
        """
          SP-自动搜索词-自动1-紧密-自动精否 3步
          :param get_token:
          :param get_api_profiler:
          :return:
          """
        url = self.base_url + "/v1/ad_strategy/auto_search_root_submit"
        headers = {
            "Authorization": self.token,
            "Carving-Advertising-Api-Profile": get_api_profiler
        }
        json = {
            "root_task_id": self.root_task_id,
            "asin_root_selected": [],
            "keyword_root_selected": []
        }
        response = self.request(method="POST", url=url, headers=headers, json=json)
        return response

    def ad_auto_search_policy2(self, get_api_profiler):
        """
          SP-自动搜索词-自动2-宽泛
          :param get_token:
          :param get_api_profiler:
          :return:
          """
        url = self.base_url + "/v1/ad_strategy/auto_search_policy"
        headers = {
            "Authorization": self.token,
            "Carving-Advertising-Api-Profile": get_api_profiler
        }
        json = {
            "ad_type": "sp",
            "rule_model": "B",
            "module": "sp_auto_search_b_normal",
            "campaign_configs": [
                {
                    "asin_down_limit": 2,
                    "asin_up_limit": 3,
                    "campaign_id": 151636291523007,
                    "campaign_name": "US-17*33in 电暖垫-自动2-B0B3MBQC57",
                    "hight_down_limit": 2,
                    "hight_up_limit": 3.5,
                    "price": 39.99,
                    "strategy_config": 0,
                    "target_acos": 33,
                    "target_cr": 20
                }
            ],
            "ad_group_configs": [
                {
                    "ad_campaign_type": "sp_auto_b_campaign",
                    "ad_group_id": 106177895842165,
                    "ad_group_name": "自动2-宽泛",
                    "ad_group_type": "sp_auto_search_b_group",
                    "ad_type": "sp",
                    "campaign_id": 151636291523007,
                    "campaign_name": "US-17*33in 电暖垫-自动2-B0B3MBQC57",
                    "id": 796,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_ad_group_id": 796,
                    "allowed_campaign_id": 122356139507810,
                    "asin_allowed_campaign_id": 59678734728722,
                    "allowed_campaign_name": "US-17*33in 电暖垫-手动-B0B3MBQC57",
                    "asin_allowed_campaign_name": "US-17*33in 电暖垫-ASIN组-B0B3MBQC57"
                }
            ]
}
        response = self.request(method="POST", url=url, headers=headers, json=json)
        return response

    def ad_auto_search_policy_submi2(self, get_api_profiler):
        """
          SP-自动搜索词-自动2-宽泛-相关性筛选 2步
          :param get_token:
          :param get_api_profiler:
          :return:
          """
        url = self.base_url + "/v1/ad_strategy/auto_search_policy_submit"
        headers = {
            "Authorization": self.token,
            "Carving-Advertising-Api-Profile": get_api_profiler
        }
        json = {
            "policy_task_id": self.policy_task_id2,
            "asin_update_data": [
            ],
            "keyword_update_data": [
            ]
        }
        response = self.request(method="POST", url=url, headers=headers, json=json)
        return response

    def ad_auto_search_root_submit2(self, get_api_profiler):
        """
          SP-自动搜索词-自动2-紧密-自动精否 3步
          :param get_token:
          :param get_api_profiler:
          :return:
          """
        url = self.base_url + "/v1/ad_strategy/auto_search_root_submit"
        headers = {
            "Authorization": self.token,
            "Carving-Advertising-Api-Profile": get_api_profiler
        }
        json = {
            "root_task_id": self.root_task_id2,
            "asin_root_selected": [
            ],
            "keyword_root_selected": [
            ]
        }
        response = self.request(method="POST", url=url, headers=headers, json=json)
        return response

    def ad_auto_targeting_policy(self, get_api_profiler):
        """
          SP-自动投放-紧密同类
          :param get_token:
          :param get_api_profiler:
          :return:
          """
        url = self.base_url + "/v1/ad_strategy/auto_targeting_policy"
        headers = {
            "Authorization": self.token,
            "Carving-Advertising-Api-Profile": get_api_profiler
        }
        json = {
            "ad_type": "sp",
            "rule_model": "A",
            "module": "sp_auto_targeting_a_normal",
            "campaign_configs": [
                {
                    "campaign_id": 386582096614556,
                    "campaign_name": "US-17*33in 电暖垫-自动1-B0B3MBQC57",
                    "price": 39.99,
                    "strategy_config": 0,
                    "target_acos": 33,
                    "target_cr": 20
                }
            ],
            "ad_group_configs": [
                {
                    "ad_campaign_type": "sp_auto_a_campaign",
                    "ad_group_id": 549607339142042,
                    "ad_group_name": "自动1-紧密",
                    "ad_group_type": "sp_auto_search_a_group",
                    "campaign_id": 386582096614556,
                    "campaign_name": "US-17*33in 电暖垫-自动1-B0B3MBQC57",
                    "id": 840,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 840
                }
            ]
        }
        response = self.request(method="POST", url=url, headers=headers, json=json)
        return response

    def ad_auto_targeting_policy2(self, get_api_profiler):
        """
          SP-自动投放-宽泛关联
          :param get_token:
          :param get_api_profiler:
          :return:
          """
        url = self.base_url + "/v1/ad_strategy/auto_targeting_policy"
        headers = {
            "Authorization": self.token,
            "Carving-Advertising-Api-Profile": get_api_profiler
        }
        json = {
            "ad_type": "sp",
            "rule_model": "B",
            "module": "sp_auto_targeting_b_normal",
            "campaign_configs": [
                {
                    "campaign_id": 151636291523007,
                    "campaign_name": "US-17*33in 电暖垫-自动2-B0B3MBQC57",
                    "price": 39.99,
                    "strategy_config": 0,
                    "target_acos": 33,
                    "target_cr": 20
                }
            ],
            "ad_group_configs": [
                {
                    "ad_campaign_type": "sp_auto_b_campaign",
                    "ad_group_id": 106177895842165,
                    "ad_group_name": "自动2-宽泛",
                    "ad_group_type": "sp_auto_search_b_group",
                    "campaign_id": 151636291523007,
                    "campaign_name": "US-17*33in 电暖垫-自动2-B0B3MBQC57",
                    "id": 796,
                    "portfolio_id": 22396183415978,
                    "portfolio_name": "加热垫",
                    "sys_sp_group_id": 796
                }
            ]
        }
        response = self.request(method="POST", url=url, headers=headers, json=json)
        return response
